<!DOCTYPE html>
<html>
<head>
    <title>用户列表</title>$css()
</head>
<body>
<div>
    <a class="btn btn-min" href="javascript:void(0)" onclick="newRec()">添加新的角色</a>
</div>
<div>
    <div id="dg" class="control"></div>
    <div class="ui-table-meta" id="pager"></div>
</div>

$js()
<script type="text/javascript">
    //jr.dom.fitHeight(jr.$('dg'));
    var _dg = $jr.dataGrid('dg', {
        data: { page: 1 },
        idField: 'UserName',
        columns: [
            { field: 'Name', title: '角色名', align: 'center', width: 100, formatter: null },
            { field: 'AppId', title: '站点', align: 'center', width: 150, formatter: null },
            { field: 'Enabled', title: '可用', align: 'center', width: 150, formatter: function (v) { return v == 1 ? "可用" : "不可用"; } },
            {field:''}
        ],
        loaded: function(data) {
            var tables = document.getElementsByTagName('TABLE');
            jr.table.dynamic(tables[1], false);
            //加载分页
            this.panel.nextSibling.innerHTML = data.pager;
        }
    });

    _dg.load(${data});
   
    function newRec() {
        jr.dialog.create2('新建用户', true, true).open('?module=user&action=newUser',700,400);
    }
    function editRec(id) {
        jr.dialog.create2('编辑用户', true, true).open('?module=user&action=updateUser&id='+id, 700, 400);
    }

    function extRec(id) {
        jr.tab.open('用户角色管理','?module=user&action=UserRole&id=' + id,true);
    }

</script>
</body>
</html>
